Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast dictionary to any during assignment #1357

Merged
merged 2 commits into from
Apr 12, 2021
Merged

cast dictionary to any during assignment #1357

merged 2 commits into from
Apr 12, 2021

Conversation

jjoekoullas
Copy link
Contributor

@jjoekoullas jjoekoullas commented Apr 9, 2021

This attempts to fix RicoSuter/NSwag#2881 by simply casting dictionaries to any before doing assignment.

As far as I can tell, there isn't a great way to fix this outside of casting the dictionary to any. Even if the keys are properly typed, you can still run into issues with read-only values being assigned. Since this is a fully internal operation casting the dictionary to any seems safe enough.

I'm having a lot of trouble figuring out how to get this built and how to use it locally in order to test it however.

@RicoSuter
Copy link
Owner

RicoSuter commented Apr 12, 2021

As you only have changes in templates, you can test your changes by simply overriding the given templates:

https://github.com/RicoSuter/NJsonSchema/wiki/Templates
https://github.com/RicoSuter/NSwag/wiki/Templates

If everything is fine we can merge the PR.

Btw, the tests failed so you'd need to update/fix them as well.

@jjoekoullas
Copy link
Contributor Author

@RicoSuter thank you!

Tested my changed via the template directory like you suggested - they're working fine now.

Updated tests, they pass locally.

@RicoSuter RicoSuter merged commit 8853956 into RicoSuter:master Apr 12, 2021
@RicoSuter
Copy link
Owner

Thanks for the PR.

@jjoekoullas jjoekoullas deleted the typescriptStrictTS7015 branch April 13, 2021 15:03
adamjones1 pushed a commit to adamjones1/NJsonSchema that referenced this pull request May 24, 2021
* patch/improved-enum-handling

* Improved enum handling resolves RicoSuter#1357

* Added tests to cover operators and plus or minus characters

* Update DefaultEnumNameGenerator.cs

Co-authored-by: Rico Suter <mail@rsuter.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect handling of Dictionary in Angular Client
2 participants